﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace Control
{
    public partial class ctrlTinhHinhMuonSachTheoTheLoai : DevExpress.XtraEditors.XtraUserControl
    {
        public ctrlTinhHinhMuonSachTheoTheLoai()
        {
            InitializeComponent();

            //format date
            this.dateThoiGian.Properties.DisplayFormat.FormatString = "MM/yyyy";
            this.dateThoiGian.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.DateTime;
            this.dateThoiGian.Properties.EditFormat.FormatString = "MM/yyyy";
            this.dateThoiGian.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.DateTime;
            this.dateThoiGian.Properties.Mask.EditMask = "MM/yyyy";
        }
        
        private void ctrlTinhHinhMuonSachTheoTheLoai_Load(object sender, EventArgs e)
        {
            dateThoiGian.DateTime = DateTime.Today;
        }

        private void btnXemBaoCao_Click(object sender, EventArgs e)
        {
            int Thang = dateThoiGian.DateTime.Month;
            int Nam = dateThoiGian.DateTime.Year;

            rptTinhHinhMuonSachTheoTheLoai rpt = new rptTinhHinhMuonSachTheoTheLoai();
            rpt.SetParameterValue("Nam", Nam);
            rpt.SetParameterValue("Thang", Thang);

            crystalReportViewer1.ReportSource = rpt;
        }
    }
}
